package com.fourth.controller;

import com.fourth.service.AppealService;
import com.ljx.entity.Appeal;
import com.ljx.vo.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.sound.midi.Soundbank;


/**
 * @author C-Q
 * @version 1.1.0
 * @Description: 申诉处理
 * @date 2023/2/27
 */
@RestController
@RequestMapping("/merchant")
public class AppealController {
    @Resource
    private AppealService appealService;

    /**
     * 申诉处理表查全表
     * @param currentPage
     * @param pageSize
     * @param appeal
     * @return
     */
    @PostMapping("appealController")
    public Result appealController(@RequestParam(defaultValue = "1") Integer currentPage,@RequestParam(defaultValue = "5")Integer pageSize,@RequestBody Appeal appeal){
       return appealService.appealSelectAll(currentPage , pageSize,appeal);
    }

    /**
     * 通过ID将当前表状态 status = 1
     * @param
     * @return
     */
    @RequestMapping("passController")
    public Result passController(Integer id , Integer status){
        return appealService.passAppeal(id,status);
    }


    @RequestMapping("appealShenSu")
    public Result appealShenSu(@RequestParam(defaultValue = "1") Integer currentPage,@RequestParam(defaultValue = "5")Integer pageSize,@RequestBody Appeal appeal){

        System.out.println(appeal);
        return appealService.addAppealAll(currentPage , pageSize,appeal);
    }

    /**
     * 根据ID改变申诉表中商家申诉状态
     * @param id
     * @param status
     * @return
     */
    @RequestMapping("statusAppeal")
    public Result statusAppeal(Integer id , Integer status,String busid){
        Result result = appealService.appealStatusId(id, status,busid);
        System.out.println(id+""+status+""+busid);
        return result;
    }
}
